package com.atguigu.srb.core.controller.admin;


import com.atguigu.common.result.R;
import com.atguigu.srb.core.pojo.entity.UserLoginRecord;
import com.atguigu.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户登录记录表 前端控制器
 * </p>
 *
 * @author 杜佳佳
 * @since 2021-04-13
 */
@Api(tags = "用户登录管理")
@RestController
@RequestMapping("/admin/core/userLoginRecord")
public class AdminUserLoginRecordController {

    @Autowired
    private UserLoginRecordService userLoginRecordService;

    @ApiOperation("获取最近50条登录日志")
    @GetMapping("getListTop/{userId}")
    public R listTop50(@PathVariable("userId") Long userId) {
        List<UserLoginRecord> list = userLoginRecordService.selectListTop(userId);
        return R.ok().data("list",list);
    }

}

